/**      
 * @file		Fibonacci.cpp
 * @description		This is another example of a recursive solution to
 *			a problem of finding the Fibonacci series numbers 
 *			based on some index n.
 *			The Fibonacci series
 *			0, 1, 1, 2, 3, 5, 8, 13, 21, ...
 *			begins with 0 and 1 and has the property that each subsequent 
 *			Fibonacci number is the sum of the previous two Fibonacci numbers.
 *			The Fibonacci number of n = 0 is 0
 *			The Fibonacci number of n = 1 is 1
 *
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		1.0
 */
#include <iostream>
using namespace std;

/**
 * Calculates the Fibonacci series based on the integer n.
 * @param n the nth Fibonacci number 
 * @return the Fibonacci number of n
 * @pre n must be some non-negative number
 * @post the Fibonacci number has been calculated for n
 */
int fibonacci(int aN);

/**
 * @return zero if the application executes successfully
 */
int main() {
	int n;
	cout <<  "Enter an index for the Fibonacci number: ";
    cin >> n;

	cout << "Fibonacci number for n = " << n;
	cout << " is " << fibonacci(n) << endl;

	return 0;
}

int fibonacci(int aN) {
	if (aN == 0) { // Base case
		return 0;
	} else if (aN == 1) { // Base case
		return 1;
	} else { // Reduction and recursive calls
		return fibonacci(aN - 1) + fibonacci(aN - 2);
	}
}
